/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.eps.modelo.javabeans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author luis
 */
@Entity
@Table(name = "T_PadronLectura")
@NamedQueries({
    @NamedQuery(name = "PadronLectura.findAll", query = "SELECT p FROM PadronLectura p"),
    @NamedQuery(name = "PadronLectura.findByZona", query = "SELECT p FROM PadronLectura p WHERE p.zona = :zona"),
    @NamedQuery(name = "PadronLectura.findByLocalidad", query = "SELECT p FROM PadronLectura p WHERE p.localidad = :localidad"),
    @NamedQuery(name = "PadronLectura.findByDistrito", query = "SELECT p FROM PadronLectura p WHERE p.distrito = :distrito"),
    @NamedQuery(name = "PadronLectura.findBySector", query = "SELECT p FROM PadronLectura p WHERE p.sector = :sector"),
    @NamedQuery(name = "PadronLectura.findByManzana", query = "SELECT p FROM PadronLectura p WHERE p.manzana = :manzana"),
    @NamedQuery(name = "PadronLectura.findByLocal", query = "SELECT p FROM PadronLectura p WHERE p.local = :local"),
    @NamedQuery(name = "PadronLectura.findBySublocal", query = "SELECT p FROM PadronLectura p WHERE p.sublocal = :sublocal"),
    @NamedQuery(name = "PadronLectura.findBySecuencia", query = "SELECT p FROM PadronLectura p WHERE p.secuencia = :secuencia"),
    @NamedQuery(name = "PadronLectura.findByNumeroMedidor", query = "SELECT p FROM PadronLectura p WHERE p.numeroMedidor = :numeroMedidor"),
    @NamedQuery(name = "PadronLectura.findByTipoLectura", query = "SELECT p FROM PadronLectura p WHERE p.tipoLectura = :tipoLectura"),
    @NamedQuery(name = "PadronLectura.findByLecturaTomada", query = "SELECT p FROM PadronLectura p WHERE p.lecturaTomada = :lecturaTomada"),
    @NamedQuery(name = "PadronLectura.findByObservacion", query = "SELECT p FROM PadronLectura p WHERE p.observacion = :observacion"),
    @NamedQuery(name = "PadronLectura.findByTCicloMedicionID", query = "SELECT p FROM PadronLectura p WHERE p.padronLecturaPK.tCicloMedicionID = :tCicloMedicionID"),
    @NamedQuery(name = "PadronLectura.findByCorrelativo", query = "SELECT p FROM PadronLectura p WHERE p.padronLecturaPK.correlativo = :correlativo")})
public class PadronLectura implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PadronLecturaPK padronLecturaPK;
    @Basic(optional = false)
    @Column(name = "zona")
    private int zona;
    @Basic(optional = false)
    @Column(name = "localidad")
    private int localidad;
    @Basic(optional = false)
    @Column(name = "distrito")
    private int distrito;
    @Basic(optional = false)
    @Column(name = "sector")
    private int sector;
    @Basic(optional = false)
    @Column(name = "manzana")
    private String manzana;
    @Basic(optional = false)
    @Column(name = "local")
    private String local;
    @Basic(optional = false)
    @Column(name = "sublocal")
    private String sublocal;
    @Basic(optional = false)
    @Column(name = "secuencia")
    private int secuencia;
    @Basic(optional = false)
    @Column(name = "numeroMedidor")
    private String numeroMedidor;
    @Basic(optional = false)
    @Column(name = "tipoLectura")
    private short tipoLectura;
    @Basic(optional = false)
    @Column(name = "lecturaTomada")
    private int lecturaTomada;
    @Basic(optional = false)
    @Column(name = "observacion")
    private String observacion;
    @JoinColumn(name = "T_CicloMedicion_ID", referencedColumnName = "T_CicloMedicion_ID", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private CicloMedicion cicloMedicion;
    @JoinColumn(name = "T_Cliente_ID", referencedColumnName = "T_Cliente_ID")
    @ManyToOne(optional = false)
    private Cliente tClienteID;
    @JoinColumn(name = "T_Ruta_ID", referencedColumnName = "T_Ruta_ID")
    @ManyToOne(optional = false)
    private Ruta tRutaID;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "padronLectura")
    private List<Consumo> consumoList;

    public PadronLectura() {
    }

    public PadronLectura(PadronLecturaPK padronLecturaPK) {
        this.padronLecturaPK = padronLecturaPK;
    }

    public PadronLectura(PadronLecturaPK padronLecturaPK, int zona, int localidad, int distrito, int sector, String manzana, String local, String sublocal, int secuencia, String numeroMedidor, short tipoLectura, int lecturaTomada, String observacion) {
        this.padronLecturaPK = padronLecturaPK;
        this.zona = zona;
        this.localidad = localidad;
        this.distrito = distrito;
        this.sector = sector;
        this.manzana = manzana;
        this.local = local;
        this.sublocal = sublocal;
        this.secuencia = secuencia;
        this.numeroMedidor = numeroMedidor;
        this.tipoLectura = tipoLectura;
        this.lecturaTomada = lecturaTomada;
        this.observacion = observacion;
    }

    public PadronLectura(int tCicloMedicionID, short correlativo) {
        this.padronLecturaPK = new PadronLecturaPK(tCicloMedicionID, correlativo);
    }

    public PadronLecturaPK getPadronLecturaPK() {
        return padronLecturaPK;
    }

    public void setPadronLecturaPK(PadronLecturaPK padronLecturaPK) {
        this.padronLecturaPK = padronLecturaPK;
    }

    public int getZona() {
        return zona;
    }

    public void setZona(int zona) {
        this.zona = zona;
    }

    public int getLocalidad() {
        return localidad;
    }

    public void setLocalidad(int localidad) {
        this.localidad = localidad;
    }

    public int getDistrito() {
        return distrito;
    }

    public void setDistrito(int distrito) {
        this.distrito = distrito;
    }

    public int getSector() {
        return sector;
    }

    public void setSector(int sector) {
        this.sector = sector;
    }

    public String getManzana() {
        return manzana;
    }

    public void setManzana(String manzana) {
        this.manzana = manzana;
    }

    public String getLocal() {
        return local;
    }

    public void setLocal(String local) {
        this.local = local;
    }

    public String getSublocal() {
        return sublocal;
    }

    public void setSublocal(String sublocal) {
        this.sublocal = sublocal;
    }

    public int getSecuencia() {
        return secuencia;
    }

    public void setSecuencia(int secuencia) {
        this.secuencia = secuencia;
    }

    public String getNumeroMedidor() {
        return numeroMedidor;
    }

    public void setNumeroMedidor(String numeroMedidor) {
        this.numeroMedidor = numeroMedidor;
    }

    public short getTipoLectura() {
        return tipoLectura;
    }

    public void setTipoLectura(short tipoLectura) {
        this.tipoLectura = tipoLectura;
    }

    public int getLecturaTomada() {
        return lecturaTomada;
    }

    public void setLecturaTomada(int lecturaTomada) {
        this.lecturaTomada = lecturaTomada;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public CicloMedicion getCicloMedicion() {
        return cicloMedicion;
    }

    public void setCicloMedicion(CicloMedicion cicloMedicion) {
        this.cicloMedicion = cicloMedicion;
    }

    public Cliente getTClienteID() {
        return tClienteID;
    }

    public void setTClienteID(Cliente tClienteID) {
        this.tClienteID = tClienteID;
    }

    public Ruta getTRutaID() {
        return tRutaID;
    }

    public void setTRutaID(Ruta tRutaID) {
        this.tRutaID = tRutaID;
    }

    public List<Consumo> getConsumoList() {
        return consumoList;
    }

    public void setConsumoList(List<Consumo> consumoList) {
        this.consumoList = consumoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (padronLecturaPK != null ? padronLecturaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PadronLectura)) {
            return false;
        }
        PadronLectura other = (PadronLectura) object;
        if ((this.padronLecturaPK == null && other.padronLecturaPK != null) || (this.padronLecturaPK != null && !this.padronLecturaPK.equals(other.padronLecturaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "murguia.ejb30.entity.COMER.PadronLectura[padronLecturaPK=" + padronLecturaPK + "]";
    }

}
